package com.lzh.healthCode.business.controller;

import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.lzh.healthCode.business.entity.*;
import com.lzh.healthCode.business.service.CjInfoService;
import com.lzh.healthCode.business.service.JgInfoService;
import com.lzh.healthCode.business.service.ZyInfoService;
import com.lzh.healthCode.core.BaseConfig;
import com.lzh.healthCode.utils.UpdAreaEnum;
import com.lzh.healthCode.utils.UpdTypeEnum;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

@RestController
@RequestMapping("Time")
@Slf4j
public class TimingController extends BaseConfig {

    @Resource
    CjInfoService cjInfoService;

    @Resource
    ZyInfoService zyInfoService;

    @Resource
    JgInfoService jgInfoService;



    public void sampleReport(UpdAreaEnum updAreaEnum, UpdTypeEnum updTypeEnum) {
        // 测试人员信息上传接口 【参数】
        UpdParams updParams = new UpdParams(updAreaEnum, updTypeEnum);
        List<CjInfoBean> selectAll = cjInfoService.getSelectTime(updParams);
        for (CjInfoBean cjInfoBean : selectAll) {
            commonService.uploadSampleReport(updAreaEnum, updTypeEnum, cjInfoBean);
        }
    }


    public void transportReport(UpdAreaEnum updAreaEnum, UpdTypeEnum updTypeEnum) {
        // 测试人员信息上传接口 【参数】
        UpdParams updParams = new UpdParams(updAreaEnum, updTypeEnum);
        List<ZyInfoBean> selectAll = zyInfoService.getSelectTime(updParams);
        for (ZyInfoBean zyInfoBean : selectAll) {
            commonService.uploadtransportReport(updAreaEnum, updTypeEnum, zyInfoBean);
        }

    }


    public void checkResultReport1(UpdAreaEnum updAreaEnum, UpdTypeEnum updTypeEnum) {
        // 测试人员信息上传接口 【参数】
        UpdParams updParams = new UpdParams(updAreaEnum, updTypeEnum);
        List<JgInfoBean> selectAll = jgInfoService.getSelectTime(updParams);
        for (JgInfoBean jgInfoBean : selectAll) {
            commonService.uploadcheckResultReport(updAreaEnum, updTypeEnum, jgInfoBean);
        }

    }
    }


